package com.jiawa.train.common.util;

import cn.hutool.core.util.IdUtil;

/**
 * 封装hutool雪花算法
 */
public class SnowUtil {
    private static long datacenterId=1;//数据中心
    private static long workerId=1;//机器标识

    public static long getSnowflakeNextId(){
        return IdUtil.getSnowflake(workerId,datacenterId).nextId();
    }

    public static String getSnowflakeNextIdStr(){
        return IdUtil.getSnowflake(workerId,datacenterId).nextIdStr();
    }
}
